<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:th="http://www.thymeleaf.org"
      xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
<head th:include="common_css :: commonHeader('脚本管理')"></head>
<body>
<!--搜索框-->
<form method="post" id="tabfrom">
    <div style="padding:2px" class="easyui-panel" title="数据查询">
        <table class="form-table">
            <tr>
                <td align="right">所属模块：</td>
                <td>
                    <input id="selModular" name="selModular" style="width: 350px" multiple="multiple"
                           cascadeCheck="true"
                           data-options="required:false,prompt:'==请选择==',panelHeight:'auto'"
                           class="easyui-combotree"/>
                </td>
            </tr>
            <tr>
                <td align="right">所属客户：</td>
                <td>
                    <input id="selCustomer" name="selCustomer" style="width: 350px" multiple="multiple"
                           cascadeCheck="true"
                           data-options="required:false,prompt:'==请选择=='"
                           class="easyui-combotree"/>
                </td>
            </tr>
            <tr>
                <td align="right">所属报表：</td>
                <td>
                    <input id="selReport" name="selReport" style="width: 350px" multiple="multiple"
                           cascadeCheck="true"
                           data-options="required:false,prompt:'==请选择==',panelHeight:'auto'"
                           class="easyui-combotree"/>
                </td>
            </tr>
            <tr>
                <td align="right" width="10%">需求BUG编号：</td>
                <td align="left">
                    <input style="width:350px" id="selDemandBugId"
                           data-options="valueField:'id',textField:'demandBugNum' ,panelWidth:'auto',prompt:'==请选择=='"
                           class="easyui-combobox"/>
                </td>
            </tr>
        </table>
        <table class="form-table">
            <tr>
                <td align="right" width="10%">SQL脚本：</td>
                <td align="left">
                    <input style="width:150px" id="selSqlScript"/>
                </td>
                <td align="right" width="10%">状态：</td>
                <td align="left">
                    <input style="width:150px" id="selStatus"
                           data-options="valueField:'value',textField:'showmsg' ,panelHeight:'auto',prompt:'==请选择=='"
                           class="easyui-combobox"/>
                </td>
                <td align="right" width="10%">版本号：</td>
                <td>
                    <input style="width:150px" id="selVersion"
                           data-options="valueField:'value',textField:'showmsg' ,panelHeight:'auto',prompt:'==请选择=='"
                           class="easyui-combobox"/>
                    <a class="easyui-linkbutton" iconCls='icon-search' onclick="doSearch();">查询</a>
                </td>
            </tr>
        </table>
    </div>
    <br>
</form>
<div id="toolbar">
    <shiro:hasPermission name="reportworld:sqlScript:add">
        <a href="javascript:void(0)" class="easyui-linkbutton" iconcls="icon-add"
           onclick="addSqlScript()">添加</a>
    </shiro:hasPermission>
    <shiro:hasPermission name="reportworld:sqlScript:edit">
        <a href="javascript:void(0)" class="easyui-linkbutton" iconcls="icon-edit"
           onclick="editSqlScript()">修改</a>
    </shiro:hasPermission>
    <shiro:hasPermission name="reportworld:sqlScript:del">
        <a href="javascript:void(0)" class="easyui-linkbutton" iconcls="icon-cancel"
           onclick="delSqlScript()">删除</a>
    </shiro:hasPermission>
    <shiro:hasPermission name="reportworld:sqlScript:process">
        <a href="javascript:void(0)" class="easyui-linkbutton" iconcls="icon-database-table"
           onclick="processSqlScript()">审核</a>
    </shiro:hasPermission>
    <shiro:hasPermission name="reportworld:sqlScript:rebut">
        <a href="javascript:void(0)" class="easyui-linkbutton" iconcls="icon-chart-curve"
           onclick="rebutSqlScript()">退回</a>
    </shiro:hasPermission>
    <shiro:hasPermission name="reportworld:sqlScript:reduction">
        <a href="javascript:void(0)" id="reductionData" class="easyui-linkbutton" iconcls="icon-drink"
           onclick="reductionData()">还原</a>
    </shiro:hasPermission>
    <shiro:hasPermission name="reportworld:sqlScript:down">
        <a href="javascript:void(0)" class="easyui-linkbutton" iconcls="icon-disk"
           onclick="downSqlScriptFile()">导出</a>
    </shiro:hasPermission>
</div>

<div id="dg"></div>


<div id="dlg" class="easyui-dialog" style="width:950px;height:610px"
     closed="true" modal="true" maximizable="true" resizable="true">
    <form id="myform" method="post">
        <div style="padding:20px">
            <table cellpadding="2px" cellspacing="0" class="form-table">
                <input type="hidden" id="id" name="id">
                <tr id="approvalReasonTr" style="display: none">
                    <td align="right">退回原因：</td>
                    <td colspan="3">
                        <input class="easyui-textbox" name="approvalReason" readonly
                               data-options="multiline:true" style="height:80px;width:450px"/>
                    </td>
                </tr>
                <tr>
                    <td align="right">所属模块：</td>
                    <td>
                        <input id="modularId" name="modularId" style="width: 350px"
                               data-options="required:false,prompt:'==请选择==',panelHeight:'auto'"
                               class="easyui-combotree"
                               validType="comtreeValidate['modularId','请选择所属模块']"/>
                    </td>
                </tr>
                <tr>
                    <td align="right">所属客户：</td>
                    <td>
                        <input id="customerId" name="customerId" style="width: 350px"
                               cascadeCheck="true"
                               data-options="required:false,prompt:'==请选择=='"
                               class="easyui-combotree"
                               validType="comtreeValidate['customerId','请选择所属客户']"/>
                    </td>
                </tr>
                <tr>
                    <td align="right">所属报表：</td>
                    <td>
                        <input id="reportId" name="reportId" style="width: 350px"
                               data-options="required:false,prompt:'==请选择==',panelHeight:'auto'"
                               class="easyui-combotree"
                               validType="comtreeValidate['reportId','请选择所属报表']"/>
                    </td>
                </tr>
                <tr>
                    <td align="right">需求/BUG编号：</td>
                    <td>
                        <input id="demandBugId" name="demandBugId" style="width: 350px" class="easyui-combobox"
                               missingMessage="请选择对应需求/BUG编号"
                               data-options="required:false,valueField:'id',textField:'demandBugNum' ,panelWidth:'auto',prompt:'==请选择=='"
                               validType="comboxValidate['demandBugId','请选择正确的需求或者BUG编号']"/>
                    </td>
                </tr>
                <tr>
                    <td align="right">表所在分层：</td>
                    <td>
                        <input id="layered" name="layered" class="easyui-combobox"
                               data-options="required:false,valueField:'value',textField:'showmsg',prompt:'==请选择==',panelHeight:'auto'"
                               missingMessage="请维护报表世界所在分层" validType="comboxValidate['layered','请维护报表世界所在分层']"/>
                    </td>
                </tr>
                <tr>
                    <td align="right">数据库类型：</td>
                    <td>
                        <input id="dataBaseType" name="dataBaseType" missingMessage="请选择数据库类型"
                               data-options="valueField:'value',textField:'showmsg' ,panelHeight:'auto',prompt:'==请选择=='"
                               class="easyui-combobox" validType="comboxValidate['dataBaseType','请维护数据库类型']"/>
                    </td>
                </tr>

                <tr>
                    <td align="right">是否按照业务主键覆盖：</td>
                    <td>
                        <input id="coverPrimaryKey" name="coverPrimaryKey" ediDataSql="false"
                               class="easyui-combobox" data-options="prompt:'==请选择==',panelHeight:'auto', valueField: 'label', textField: 'value',
                                    data: [{ label: '1',  value: '是' },{ label: '2', value: '否'}]"
                               validType="comboxValidate['coverPrimaryKey','请选择是否按照业务主键覆盖']"/>

                    </td>
                </tr>

                <tr>
                    <td></td>
                    <td>
                        <a href="javascript:void(0)" class="easyui-linkbutton" iconCls="icon-application-form-add"
                           onclick="uploadFile.click();">脚本文件</a>
                    </td>
                </tr>
                <tr>
                    <td align="right">SQL脚本：</td>
                    <td colspan="3">
                        <input class="easyui-textbox" name="sqlScript" id="sqlScript"
                               data-options="required:true,multiline:true"
                               validType="length[10,1200000]"
                               style="height:350px;width:650px"/>
                    </td>
                </tr>
                <tr>
                    <td align="right">SQL说明：</td>
                    <td colspan="3">
                        <input class="easyui-textbox" name="description"
                               data-options="multiline:true" style="height:80px;width:650px"/>
                    </td>
                </tr>
                <tr>
                    <td align="right">版本号：</td>
                    <td>
                        <input name="version" id="sqlScriptVersion"
                               data-options="valueField:'value',textField:'showmsg' ,panelHeight:'auto',prompt:'==请选择=='"
                               class="easyui-combobox"/>
                    </td>
                </tr>
            </table>
        </div>
    </form>
</div>
<div id="msgInfoDialog" class="easyui-dialog" style="width:1000px;height:510px"
     closed="true" modal="true" maximizable="true" resizable="true">
    <input class="easyui-textbox" name="msgInfo" id="msgInfo"
           data-options="multiline:true" style="height:100%;width:100%"/>
</div>

<div id="rebutSqlScript" class="easyui-dialog" style="width:600px;height:310px"
     closed="true" modal="true" maximizable="true" resizable="true">
    <form id="myform2" method="post">
        <div style="padding:20px">
            <table cellpadding="2px" cellspacing="0" class="form-table">
                <tr>
                    <td align="right">退回原因：</td>
                    <td colspan="3">
                        <input class="easyui-textbox" name="approvalReason" id="approvalReason"
                               data-options="required:true,multiline:true" style="height:80px;width:450px"/>
                    </td>
                </tr>
            </table>
        </div>
    </form>
</div>

<div style="display: none;">
    <form id="subFile" enctype="multipart/form-data" method="post">
        <input accept=".txt,.TXT,.sql,.SQL" name="multipartfile" type="file"
               id="uploadFile" onchange="setFilePreview(this.value);">
    </form>
</div>

<div id="dlgReductionVersion" class="easyui-dialog" style="width:400px;height:300px"
     closed="true" modal="true" maximizable="true" resizable="true">
    <div style="padding:20px">
        <table cellpadding="2px" cellspacing="0" class="form-Database">
            <tr>
                <td>还原版本号：</td>
                <td><input id="reductionVersion" name="reductionVersion"
                           data-options="required:true,valueField:'value',textField:'showmsg' ,panelHeight:'auto',prompt:'==请选择=='"
                           class="easyui-combobox" missingMessage="请选择要还原的版本号"
                           validType="comboxValidate['reductionVersion','请选择要还原的版本号']"/></td>
            </tr>
        </table>
    </div>
</div>
<!--当前登录的登录名称-->
<input type="hidden" id="userLoginId" th:value="${user.loginId}">
<div th:include="common_js :: commJS"></div>
<script type="text/javascript"
        th:src="@{/js/reportworld/sqlScript.js}"></script>
</body>
</html>
